package spitfire.ksim.view;

import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;

import spitfire.ksim.node.KSensor;
import spitfire.ksim.node.KSensorNode;

public class KNodePanel extends JPanel {
	private static final long serialVersionUID = 3015540603125013427L;
//	private KSensorNode sNode;
	public KNodePanel(KSensorNode sNode) {
		super();
		setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
//		this.sNode = sNode;
		List<KSensor> sensorList = sNode.getSensorList();
		for (KSensor sensor : sensorList) {
			JPanel wrapper = new JPanel();
			wrapper.setLayout(new BoxLayout(wrapper, BoxLayout.PAGE_AXIS));
			wrapper.add(new KSensorDataPanel(sensor, sNode.getSimulator()));
			wrapper.setBorder(BorderFactory.createCompoundBorder(
					BorderFactory.createTitledBorder(sensor.getSensorType()),
					BorderFactory.createEmptyBorder(-8,0,0,0)));
			this.add(wrapper);
		}
	}
}
